﻿@using Microsoft.AspNetCore.Localization
@inject Microsoft.Extensions.Configuration.IConfiguration configuration
@inject Microsoft.AspNetCore.Hosting.IWebHostEnvironment environment
@inject Chino.IdentityServer.Services.Localization.IJsonLocalizationService JL

@using Chino.IdentityServer.Const
@{
    string themeName = Context.Request.Cookies[ChinoConst.ThemeNameCookieKey];

    var currentCulture = Context.Features.Get<IRequestCultureFeature>()?.RequestCulture?.UICulture;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@(ViewData["Title"] ?? "Chino") - @JL[configuration["Chino:PageTitle"] ?? "Chino", currentCulture]</title>

    <link rel="stylesheet" href="~/css/chino.css" />

    <environment include="Development">
        <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
    </environment>
    <environment exclude="Development">
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-alpha3/dist/css/bootstrap.min.css"
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
              asp-fallback-test-class="col-auto" asp-fallback-test-property="width"
              asp-fallback-test-value="auto"
              integrity="sha384-CuOF+2SnTUfTwSZjCXf01h7uYhfOBuxIhGKPbfEJ3+FqH/s6cIFN9bGr1HmAg4fQ"
              crossorigin="anonymous" />
    </environment>

</head>
<body>
    <header>
        <partial name="Nav" />
    </header>
    <div class="container body-container">
        <main role="main" class="pb-3">
            @RenderBody()
        </main>
    </div>

    @*Footer*@
    <partial name="Footer" />


    <script src="~/js/chino.js" asp-append-version="true"></script>

    <environment include="Development">
        @*开发模式下的JS引用之类的*@
        <script src="~/lib/jquery/dist/jquery.js"></script>
        <script src="~/lib/bootstrap/dist/js/bootstrap.bundle.js"></script>
        <script src="~/lib/vue/vue.js"></script>
    </environment>
    <environment exclude="Development">
        @*发布模式下的js引用之类的*@
        <script src="~/lib/jquery/dist/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-alpha3/dist/js/bootstrap.bundle.min.js"
                asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"
                asp-fallback-test="bootstrap"
                integrity="sha384-popRpmFF9JQgExhfw5tZT4I9/CI5e2QcuUZPOVXb1m7qUmeR2b50u+YFEYe1wgzy"
                crossorigin="anonymous"></script>

        <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12"
                asp-fallback-src="~/lib/vue/vue.min.js"
                asp-fallback-test="Vue"
                crossorigin="anonymous"></script>
    </environment>

    @await RenderSectionAsync("Scripts", required: false)
</body>
</html>
